package com.xuecheng.content.feignclient.media;

import com.xuecheng.content.config.MultipartSupportConfig;
import com.xuecheng.media.model.po.MediaFiles;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value="media-api",path="/media",contextId="mediaFile",
//configuration= MultipartSupportConfig.class,
fallbackFactory=MediaFileClientFactory.class)
public interface MediaFileClient {
    @GetMapping("/{id}")
    MediaFiles getById(@PathVariable("id")Long id);

    @PostMapping(value="/upload/coursefile",
    consumes= MediaType.MULTIPART_FORM_DATA_VALUE)
    MediaFiles upload(@RequestPart("filedata")MultipartFile filedata,
    @RequestParam(value="objectName",required=false)String objectName);
}
